<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:28:"themes/admin/group-list.html";i:1568365182;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/themes/admin/assets/css/layui.css">
    <script src="/themes/admin/assets/layui.js"></script>
  <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<table class="layui-table">
    <colgroup>
        <col width="150">
        <col width="200">
        <col>
    </colgroup>
    <thead>
    <tr>
        <th>ID</th>
        <th>用户组</th>
        <th>状态</th>
        <th>管理</th>
    </tr>
    </thead>
    <tbody>
    <?php if(is_array($groupList) || $groupList instanceof \think\Collection || $groupList instanceof \think\Paginator): $i = 0; $__LIST__ = $groupList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
    <tr>
        <td><?php echo $vo['id']; ?></td>
        <td><?php echo $vo['title']; ?></td>
        <td><?php echo $vo['status']; ?></td>
        <td>
            <a href="/admin/user/ruleDetail?id=<?php echo $vo['id']; ?>" class="layui-btn layui-btn-normal">编辑</a>
            <button type="button" onclick="delGroup('<?php echo $vo['id']; ?>',this)" class="layui-btn  layui-btn-danger">删除</button>
        </td>
    </tr>
    <?php endforeach; endif; else: echo "" ;endif; ?>
    </tbody>
</table>
  <script>
    layui.use("layer");
  var delGroup = function(id,obj){
    layer.confirm('确定删除该用户组？', {
        btn: ['确定','取消'] //按钮
      }, function(){
      
      $.ajax({
        type:"POST",
        data:{id:id},
        url:"/admin/user/delGroup",
        success:function(e){
        if(e.code == 1){
          $(obj).parents("tr").remove();
          layer.msg(e.msg, {icon: 1});	
        }else{
           layer.msg(e.msg, {icon: 5});
        }
        }
      })
      });
    }
  </script>
</body>
</html>